From: addshore Date: Wed, 10 Jan 2018 16:17:40 +0000 (+0000) Subject: [MCR] RevisionStore::getTitle, Fix flags passed to Title::newFromID X-Git-Tag: 1.31.0-rc.0~941 X-Git-Url: http://git.cyclocoop.org/%7D%7Cconcat%7B?a=commitdiff_plain;h=37f52ed76293a5da4257ab18223c74025ed67273;p=lhc%2Fweb%2Fwiklou.git [MCR] RevisionStore::getTitle, Fix flags passed to Title::newFromID This was passing $queryFlags directly into Title::newFromID which expects different flags. Instead we now set Title::GAID_FOR_UPDATE if $queryFlags will end up hitting the master. Change-Id: I9c6e275c22fe74a98e79c54049afa4915a7f565d --- diff --git a/includes/Storage/RevisionStore.php b/includes/Storage/RevisionStore.php index e0ee06ad85..78e789e5f4 100644 --- a/includes/Storage/RevisionStore.php +++ b/includes/Storage/RevisionStore.php @@ -176,18 +176,18 @@ class RevisionStore implements IDBAccessObject, RevisionFactory, RevisionLookup throw new InvalidArgumentException( '$pageId and $revId cannot both be 0 or null' ); } + list( $dbMode, $dbOptions, , ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); + $titleFlags = $dbMode == DB_MASTER ? Title::GAID_FOR_UPDATE : 0; $title = null; // Loading by ID is best, but Title::newFromID does not support that for foreign IDs. if ( $pageId !== null && $pageId > 0 && $this->wikiId === false ) { // TODO: better foreign title handling (introduce TitleFactory) - $title = Title::newFromID( $pageId, $queryFlags ); + $title = Title::newFromID( $pageId, $titleFlags ); } // rev_id is defined as NOT NULL, but this revision may not yet have been inserted. if ( !$title && $revId !== null && $revId > 0 ) { - list( $dbMode, $dbOptions, , ) = DBAccessObjectUtils::getDBOptions( $queryFlags ); - $dbr = $this->getDbConnectionRef( $dbMode ); // @todo: Title::getSelectFields(), or Title::getQueryInfo(), or something like that $row = $dbr->selectRow(